package com.cold.demo.rabbitmq;

import com.cold.demo.rabbitmq.demo.fanout.FanoutSender;
import com.cold.demo.rabbitmq.demo.simple.SimpleSender;
import com.cold.demo.rabbitmq.demo.work.WorkSender;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


@Component
@Order(value = 1) //执行顺序
public class StartRunner implements CommandLineRunner {

//    @Autowired
//    private SimpleSender   simpleSender;
//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//    @Autowired
//    private WorkSender     workSender;
//    @Autowired
//    private FanoutSender   fanoutSender;

    @Override
    public void run(String... args) throws Exception {
        for (int i = 0; i < 10; i++) {
//            simpleSender.send("SimpleSender====啦啦" + System.currentTimeMillis());
//            workSender.send("WorkSender====啦啦" + System.currentTimeMillis());
//            Thread.sleep(10);
//            fanoutSender.send("FanoutSender====啦啦" + System.currentTimeMillis());
        }
    }
}
